from sqlalchemy import Column, Integer, String, Text
from mooc.db.database import Base


# UserapiCache模型用于映射数据库表ims_userapi_cache
class UserapiCache(Base):
    __tablename__ = "ims_userapi_cache"

    acid = Column(Integer, primary_key=True)
    key = Column(String(32), nullable=False)
    content = Column(Text, nullable=False)
    lastupdate = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UserapiReply模型用于映射数据库表ims_userapi_reply
class UserapiReply(Base):
    __tablename__ = "ims_userapi_reply"

    acid = Column(Integer, primary_key=True)
    rid = Column(Integer, nullable=False)
    description = Column(String(300), nullable=False)
    apiurl = Column(String(300), nullable=False)
    token = Column(String(32), nullable=False)
    default_text = Column(String(100), nullable=False)
    cachetime = Column(Integer, nullable=False)

    class Config:
        from_attributes = True